<template>
  <div class="tree-ctrl-body" >
    <div class="tree-table-ctrl">
      <div class="search-ctrl f-l" >
        <input type="text" class="search-text" placeholder="搜索关键字">
        <button type="button" class="search-btn btn btn-info">搜索</button>
      </div>
      <div id="tree-dep"  class="ztree"></div>
    </div>
    <div class="tree-table-ctrl">
      <!-- {{TreeNodes}} -->
      <TreeTable></TreeTable>
      <!--<TableHtml-->
        <!--:tableHtml="initHtmlModal.table"-->
        <!--:tableRowHtml="tableRowHtml"-->
        <!--@seachTable="seachTable"-->
        <!--@PageNew="tablePageData"-->
        <!--@tableSuccess="tableSuccess"-->
      <!--&gt;</TableHtml>-->
    </div>
  </div>
</template>

<script>
  import TreeTable from "../tree/TreeTable"
  export default {
    name: "TreeStatic",
    data(){
      return{
        setting : {
          data: {
            simpleData: {
              enable: true
            },
          },
          check:{
            chkStyle:"checkbox",
            chkboxType:{ "Y": "ps", "N": "ps" },
            enable:true
          }
        },
      }
    },
    components:{
      TreeTable
    },
    mounted(){
      //添加回调
      ////console.log(this.$store.getters.getTreeUrl.treeUrl)
      const _this = this;
      this.setting.callback = {
        onClick:function(event,treeId,treeNode){
          //console.log(treeNode);
           //树结构表格加载
          _this.treeTableAjax();
        }
      };
      //初始化加载树结构
      let params = {};
      this.treeAjax(this.HOST+this.$store.getters.getTreeUrl.treeUrl,'get',params);
    },
    methods:{
      //树结构加载
      treeAjax(url,type,params){
        if( type === "post" ){

        }else if( type === "get" ){
          this.$axios[type](url)
          .then((data)=>{
            $.fn.zTree.init($("#tree-dep"), this.setting, data.data.data);
          })
          .catch((err)=>{
            //console.log(data);
          })
        }

      },

      //树结构表格加载
      treeTableAjax(url,type,params){

      }

    }
  }
</script>

<style scoped>

</style>
